package DataStructure;

/**
 * Created by dell on 2017/5/20.
 */
public class HuffmanTest {
    public static void main(String [] args) {
        int[] weight = new int[args.length];  //输入权值集合
        for(int i = 0; i < args.length; i++){
            weight[i] = Integer.parseInt(args[i]);
        }
        HuffmanTree htree = new HuffmanTree(weight);
        System.out.print(htree.toString());
        String[] code = htree.huffmanCodes();
        System.out.print("Huffman编码：");
        for(int i = 0; i < code.length; i++)
            System.out.print((char)('A' + i) + "：" + code[i] + " ");
    }
}
